home *** CD-ROM | disk | FTP | other *** search
/ Minami 85 / MINAMI85.iso / Extra / winamp535.exe / $R0 / Winamp Modern / scripts / seek.m < prev    next >
Text File  |  2005-09-15  |  1KB  |  61 lines

  1. #include <lib/std.mi>
  2.  
  3. Global Group frameGroup;
  4. Global Slider Seeker;
  5. Global Int Seeking;
  6. Global Timer SongTickerTimer;
  7. Global Text SongTicker;
  8. Global layer SeekPos;
  9.  
  10. System.onScriptLoaded() {
  11.  
  12.     frameGroup = getScriptGroup();
  13.     Seeker = frameGroup.findObject("SeekerGhost");
  14.     SongTicker = frameGroup.findObject("songticker");
  15.     SeekPos = frameGroup.findObject("player.seekbar.pos");
  16.  
  17.  
  18.     SongTickerTimer = new Timer;
  19.     SongTickerTimer.setDelay(1000);
  20.  
  21. }
  22.  
  23. SongTickerTimer.onTimer() {
  24.     SongTicker.setText("");
  25.     SongTickerTimer.stop();
  26. }
  27.  
  28. System.onScriptUnloading() {
  29.     delete SongTickerTimer;
  30. }
  31.  
  32.  
  33. Seeker.onSetPosition(int p) {
  34.     if (seeking) {
  35.         Float f;
  36.         f = p;
  37.         f = f / 255 * 100;
  38.         Float len = getPlayItemLength();
  39.         if (len != 0) {
  40.             int np = len * f / 100;
  41.             SongTickerTimer.start();
  42.             SongTicker.setText("SEEK:" + integerToTime(np) + "/" + integerToTime(len) + " (" + integerToString(f) + "%) ");
  43.         }
  44.     }
  45. }
  46.  
  47.  
  48. Seeker.onLeftButtonDown(int x, int y) {
  49.     seeking = 1;
  50. }
  51.  
  52. Seeker.onLeftButtonUp(int x, int y) {
  53.     seeking = 0;
  54.     SongTickerTimer.start();
  55.     SongTicker.setText("");
  56. }
  57.  
  58. Seeker.onSetFinalPosition(int p) {
  59.     SongTickerTimer.start();
  60.     SongTicker.setText("");
  61. }